package com.four.controller;



import com.four.pojo.Today;
import com.four.service.impl.TodayService;
import com.four.util.ResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
public class TodayController {
    @Autowired
    @Qualifier("todayService")
    private TodayService todayService;

    @RequestMapping("/findToday")
    @ResponseBody
    public ResponseMessage findToday(){
        List<Today> result = todayService.findWash2();
        return ResponseMessage.success().addObject("result", result);
    }

    @RequestMapping("/todayScore")
    public String findAllToday(Model model){
        Today wash = todayService.findWash();
        Today max = todayService.findMax();
        Today min = todayService.findMin();
        Today count = todayService.findCount();
        Today count1 = todayService.findCount1();
        Today count2 = todayService.findCount2();

        model.addAttribute("count",count);
        model.addAttribute("count1",count1);
        model.addAttribute("count2",count2);
        model.addAttribute("min",min);
        model.addAttribute("max",max);
        model.addAttribute("wash",wash);
        return "bosssystem/today_data.jsp";
    }

}
